This is a bug.
Failing spec example:
describe "freebusy problem" do
before(:each) do
cal = RiCal.parse_string(<<ENDCAL)
BEGIN:VCALENDAR METHOD:PUBLISH VERSION:2.0
PRODID:Zimbra-Calendar-Provider BEGIN:VFREEBUSY
ORGANIZER:mailto:bj-wagoner@wiu.edu
DTSTAMP:20090805T200417Z DTSTART:20090705T200417Z
DTEND:20091006T200417Z URL:https://zimbra9.wiu.edu/service/home/bjw101/calendar.ifb?null
FREEBUSY;FBTYPE=BUSY:20090705T200417Z/20090707T050000Z
FREEBUSY;FBTYPE=BUSY-TENTATIVE:20090711T050000Z/20090712T050000Z
END:VFREEBUSY END:VCALENDAR ENDCAL
@free_busy = cal.first.freebusys.first
end
it "should have two periods" do
@free_busy.freebusy.map {|fb| fb.to_s}.should == [
";FBTYPE=BUSY:20090705T200417Z/20090707T050000Z",
";FBTYPE=BUSY-TENTATIVE:20090711T050000Z/20090712T050000Z"
]
end
---------- Forwarded message ---------- From: Matt Mencel
MR-Mencel@wiu.edu
Date: Wed, Aug 5, 2009 at 5:55 PM
Subject: Trouble Using ri_cal to Parse FREEBUSY File
To: rick.denatale@gmail.com
Cc: Brad J Wagoner BJ-Wagoner@wiu.edu
Hi Rick,
I'm hoping you have time for a quick question about your ri_cal
gem.
We're trying to parse a .IFB file to grab the freebusy events
out of
it, but when we get to the point where it should be pulling the
Period
instances out....all we get back are NilClass objects. 91 one
of them
in our test file....and there are 91 periods. So it seems to
be
getting the Periods, but not grabbing data in each Period.
Here's a
small code sample...
File.open("public/calendar.ifb", "r") do
|file|
@components = RiCal.parse(file)
end
@freebusys = @components[0].freebusys()
@periods = @freebusys[0].freebusy()
At this point if we do....
@periods.each do |p| #do something with p
end
The value of p is always nil.
Any ideas? I attached the IFB file we are testing
with. Maybe there
is a problem with it?
Thanks,
Matt Mencel
Western Illinois University
-- Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale